function List () {
  let list = [
    {
      id:'1',
      name:'裤子',
      text:'',
      price: 100,
      number: 0,
      judeg: false
    },
    {
      id:'2',
      name:'鞋子',
      text:'',
      price: 100,
      number: 0,
      judeg: false
    }
  ]
  let [objList,setObjList] = useState(list)
  let [box1,setBox] = useState(false)
  let setList = (e,id) => {
    console.log(id)
    console.log(objList)
    let list = objList.map(res => {
      if(res.id === id) {
        res.number = Number.isInteger(e.target.value)
      }
      return res
    })
    setObjList(list)
      
    } // 输入
    let add = (id,judge = false) => {
      let list = objList.map(res => {
        if(res.id === id) {
          if(judge) { // 判断 增加 还是 减少 按钮
            res.number = res.number - 1
          } else {
            res.number = res.number + 1
          }
        }
        return res
      })
      console.log(list)
      setObjList(list)
    } // 新增
    let total = () => {
      let num = 0
      objList.map(res=>{
        if(res.judeg) {
          num = num + (res.price * res.number)
        } else {
          return 0
        }
      })
      return num
    } // 总价
    let box = (id,judeg) => {
      let list = objList.map(res => {
        if(res.id === id) {
          res.judeg = !judeg
        }
        return res
      })
      setObjList(list)
    } // 单选
    let all = (box) => {
      setBox(box)
      if(box) {
        let list = objList.map(res => {
          res.judeg = true
          return res
        })
        setObjList(list)
      } else {
        let list = objList.map(res => {
          res.judeg = false
          return res
        })
        setObjList(list)
      }
    } // 全选
  return <div>
    {objList.map(res=>{
      return <div key={res.id}>
        <input type='checkBox' checked={res.judeg} onChange={()=>{box(res.id,res.judeg)}} />
        <span>{res.name}</span>
        <input value={res.number} onChange={(e)=>{setList(e,res.id)}}/> 
        <span>{res.id}</span>
        <span>{res.text}</span>
        <span>单价：{res.price}</span>
        <button onClick={()=>{add(res.id)}}>增加</button>
        <button onClick={()=>{add(res.id,true)}}>减少</button>
      </div>
    })}
    <div>
      总价：{total()}
      <input type="checkBox" checked={box1} onChange={()=>{all(!box1)}} />
    </div>
  </div>
}